package com.xiang.publicdemo.module1.service.impl;

import com.xiang.publicdemo.module1.entity.User;
import com.xiang.publicdemo.module1.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl extends AbstractServiceImpl<User> implements IUserService {

    @Autowired
    private IUserService userService;
    @Override
    //@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public User add(User user) {
        return userService.test(user);
    }

    @Transactional
    public User test(User user){
        super.add(user);
        User temp = new User();
        temp.setName("test");
        temp.setCardno(user.getCardno());
        super.add(temp);
        return user;
    }

}